﻿@model MvcControl.Models.UserInfo
@{
    ViewBag.Title = "上传控件";
}
<script type="text/javascript">
    var CurrentMenu = "上传控件";
</script>
@Html.UpLoadFor(obj => obj.Header)
<script type="text/javascript" src="@Url.ContentResource("/Script/SWFUpload/swfupload.js")"></script>
<script type="text/javascript" src="@Url.ContentResource("/Script/SWFUpload/swfupload.queue.js")"></script>
<script type="text/javascript" src="@Url.ContentResource("/Script/SWFUpload/swfupload.speed.js")"></script>
<script type="text/javascript" src="@Url.ContentResource("/Script/SWFUpload/handlers.js")"></script>
<script type="text/javascript">
    

    var swfu;

    $(function () {
        var settings = {
            flash_url: "@Url.ContentResource("/Script/SWFUpload/swfupload.swf")",
            flash9_url: "@Url.ContentResource("/Script/SWFUpload/swfupload_fp9.swf")",
            upload_url: "http://localhost:20000/FileHosting/UpLoad",
            post_params: { "PHPSESSID": "<?php echo session_id(); ?>" },
            file_size_limit: "50 MB",
            file_types: "*.*",
            file_types_description: "All Files",
            file_upload_limit: 100,
            file_queue_limit: 0,
            custom_settings: {
                progressTarget: "fsUploadProgress",
                cancelButtonId: "btnCancel"
            },
            debug: false,
        
            // Button settings
		    button_image_url: "@Url.ContentResource("/Script/SWFUpload/images/XPButtonUploadText_61x22.png")",
		    button_width: "61",
		    button_height: "22",
		    button_placeholder_id: "spanButtonPlaceHolder",

		    moving_average_history_size: 40,
				
		    // The event handler functions are defined in handlers.js
		    swfupload_preload_handler : preLoad,
		    swfupload_load_failed_handler : loadFailed,
		    file_queued_handler : fileQueued,
            file_queue_error_handler : fileQueueError,
		    file_dialog_complete_handler: fileDialogComplete,
		    upload_start_handler : uploadStart,
		    upload_progress_handler : uploadProgress,
		    upload_success_handler : uploadSuccess,
		    upload_complete_handler : uploadComplete,
				
		    custom_settings : {
			    tdFilesQueued : document.getElementById("tdFilesQueued"),
			    tdFilesUploaded : document.getElementById("tdFilesUploaded"),
			    tdErrors : document.getElementById("tdErrors"),
			    tdCurrentSpeed : document.getElementById("tdCurrentSpeed"),
			    tdAverageSpeed : document.getElementById("tdAverageSpeed"),
			    tdMovingAverageSpeed : document.getElementById("tdMovingAverageSpeed"),
			    tdTimeRemaining : document.getElementById("tdTimeRemaining"),
			    tdTimeElapsed : document.getElementById("tdTimeElapsed"),
			    tdPercentUploaded : document.getElementById("tdPercentUploaded"),
			    tdSizeUploaded : document.getElementById("tdSizeUploaded"),
			    tdProgressEventCount : document.getElementById("tdProgressEventCount"),
                tdFilesName : document.getElementById("tdFilesName"),
                SuccessCallBack:function(data,file){
                    $("#tdFilesName").html( $("#tdFilesName").html()+ "data:"+data+" file:"+file.name + "<br/>");
                }
		    }


        };

        swfu = new SWFUpload(settings);
    });

    function doUpLoad(){
        alert("asdsa");
        $("#spanButtonPlaceHolder").click();
    }

</script>
<div id="content">
    <span id="spanButtonPlaceHolder"></span>
    <input type="button" class="button" value="上传" onclick="doUpLoad();" />
    <div id="tdFilesName">
    </div>
    <table cellspacing="0" class="edittable" width="100%">
        <tr>
            <th>
                Files Queued:
            </th>
            <td id="tdFilesQueued">
            </td>
        </tr>
        <tr>
            <th>
                Files Uploaded:
            </th>
            <td id="tdFilesUploaded">
            </td>
        </tr>
        <tr>
            <th>
                Errors:
            </th>
            <td id="tdErrors">
            </td>
        </tr>
    </table>
    <br />
    <table cellspacing="0" class="edittable" width="100%">
        <tr>
            <th>
                Current Speed:
            </th>
            <td id="tdCurrentSpeed">
            </td>
        </tr>
        <tr>
            <th>
                Average Speed:
            </th>
            <td id="tdAverageSpeed">
            </td>
        </tr>
        <tr>
            <th>
                Moving Average Speed:
            </th>
            <td id="tdMovingAverageSpeed">
            </td>
        </tr>
        <tr>
            <th>
                Time Remaining
            </th>
            <td id="tdTimeRemaining">
            </td>
        </tr>
        <tr>
            <th>
                Time Elapsed
            </th>
            <td id="tdTimeElapsed">
            </td>
        </tr>
        <tr>
            <th>
                Percent Uploaded
            </th>
            <td id="tdPercentUploaded">
            </td>
        </tr>
        <tr>
            <th>
                Size Uploaded
            </th>
            <td id="tdSizeUploaded">
            </td>
        </tr>
        <tr>
            <th>
                Progress Event Count
            </th>
            <td id="tdProgressEventCount">
            </td>
        </tr>
    </table>
</div>
@for (int i = 0; i < 30; i++)
{
    <br />
}
